﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterALSafa.Master" AutoEventWireup="true"
    CodeBehind="Topic_Answer.aspx.cs" Inherits="School.Pages.Teaching.Topic_Answer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script language="javascript">
        function CheckOtherIsCheckedByGVID(spanChk) {
            var IsChecked = spanChk.checked;
            if (IsChecked) {
                spanChk.parentElement.parentElement.style.backgroundColor = '#ADD8E6';  // grdEmployees.SelectedItemStyle.BackColor
                spanChk.parentElement.parentElement.style.color = 'white'; // grdEmployees.SelectedItemStyle.ForeColor
            }
            //ContentPlaceHolder1_gvBank_A
            var CurrentRdbID = spanChk.id;
            var Chk = spanChk;
            //Parent = Chk.form.elements;	
            Parent = document.getElementById('ContentPlaceHolder1_gvBank_A');
            //alert(Parent.rows.length)
            var items = Parent.getElementsByTagName('input');
            for (i = 0; i < items.length; i++) {
                if (items[i].id != CurrentRdbID && items[i].type == "radio") {
                    if (items[i].checked) {
                        items[i].checked = false;
                        items[i].parentElement.parentElement.style.backgroundColor = 'white'; //grdEmployees.ItemStyle.BackColor
                        items[i].parentElement.parentElement.style.color = 'black'; //grdEmployees.ItemStyle.ForeColor
                    }
                }
            }
        }
    </script>
    <table dir="rtl" style="width: 100%; float: right">
        <tr>
            <td>
                <fieldset>
                    <legend style="font-size: medium">اختر الاجابة الصحيحة</legend>
                    <asp:GridView ID="gvBank_A" runat="server" AlternatingRowStyle-CssClass="GridItemAltername"
                        AutoGenerateColumns="False" CssClass="Grid" DataKeyNames="Id,Question_Id" FooterStyle-CssClass="GridHeaderFooter"
                        HeaderStyle-CssClass="GridHeaderFooter" PagerStyle-CssClass="GridPager" ShowFooter="True"
                        Width="46%">
                        <AlternatingRowStyle CssClass="GridItemAltername" />
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    م
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:RadioButton ID="chcoice" runat="server" onclick="javascript:CheckOtherIsCheckedByGVID(this);" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="الاجابة" SortExpression="Choices">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txt_answ_E" runat="server" Text='<%# Bind("Choices") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server" ControlToValidate="txt_answ_E"
                                        Display="Dynamic" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:Button ID="btnsave" runat="server" CssClass="graybutton" OnClick="btnsave_Click"
                                        Text="حــفظ" />
                                </FooterTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Choices") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                            لاتوجد إجابات .........
                        </EmptyDataTemplate>
                        <FooterStyle CssClass="GridHeaderFooter" />
                        <HeaderStyle CssClass="GridHeaderFooter" />
                        <PagerStyle CssClass="GridPager" />
                    </asp:GridView>
                </fieldset>
            </td>
        </tr>
    </table>
</asp:Content>
